package test;

    //阿里常考面试题
//运行结果 3 6 7 2 1 5 4 2 1 5 4 8
    class B{
        public B(){
            System.out.println("1.B的无参构造");
        }
        {
            System.out.println("2.B的构造块");
        }
        static {
            System.out.println("3.B的静态代码块");
        }
    }
    public class D extends B {
        public D(){
            System.out.println("4.D的无参构造");
        }

        {
            System.out.println("5.D的构造块");
        }
        static {
            System.out.println("6.D的静态代码块");
        }

    public static void main(String[] args) {
        System.out.println("7.main开始-----");
        new D();
        new D();
        System.out.println("8.main结束-----");

    }
}
